<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\Request;

class BrandRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'  => 'required|unique:brands,name,' . $this->input('id'),
            'brief' => 'required'
        ];
    }

    /**
     * 自定义验证信息
     *
     * @return array
     */
    public function messages()
    {
        return [
            'name.required'  => '名称不能为空',
            'name.unique'    => '名称已存在',
            'brief.required' => '简介不能为空',
        ];
    }
}
